Skip to content

fix(first-run): keep the chosen harness and guide a multi-model save - #560

Open
Zhangbo-cn wants to merge 5 commits into
ThinkFlowLab:mainfrom
Zhangbo-cn:fix/first-run-harness-and-guidance
Open

Zhangbo-cn wants to merge 5 commits into
ThinkFlowLab:mainfrom
Zhangbo-cn:fix/first-run-harness-and-guidance

Conversation

@Zhangbo-cn

@Zhangbo-cn Zhangbo-cn commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes two first-run setup defects and two follow-up findings from the first review round:

  • [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556 — saving a language model silently reset the chosen harness. Choosing Codex (or another existing harness), going back, and then adding a language model wrote runtime: "default" back to the draft, so chat ran on Default instead of the harness the user had just picked. The draft save also validated the harness status of the wrong runtime.
  • [bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559 — a multi-model save had no guidance to step 2. Saving two or more language models jumped to the model list without saying that a choice was still required, without marking which rows were just added, and without moving focus to the first new row.
  • Editing an existing service looked like a new-model save. The language-model form reports every saved model to the welcome screen, so after "Edit service" the Added-N hint and the New · pick to continue markers appeared even though the user had not added anything. finishModelSetup now receives the edit flag and returns to the neutral language list after an edit.
  • A single-model edit auto-advanced to step 2. The same edit path still ran the "one usable model, connect it" branch before the edit check, which both skipped the neutral list and overwrote the agent selection the user had made earlier. The edit check now runs first and clears the added-model guidance.

Linked issue

  • Fixes #556
  • Fixes #559

Labels

  • type:bug, area:canvas, area:harness, area:i18n

Test plan

  • Local, at head 1d429709 (the reviewed code; later merges bring only main changes):
    • node tests/browser/first_run.mjs against an isolated fixture API with a Vite dev server and again against the production build (vite build + vite preview, the previewSafe manifest entry): passed. Journeys cover [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556 (pick Codex → Back → save one language model → draft runtime is still codex, modelSelections.agent updated; explicit OpenCode pick switches the runtime; an unavailable kept harness reports the assistant-unavailable alert and leaves the draft on codex), the default runtime on a fresh project, and [bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559 (save two language models → hint and New · pick to continue markers shown → agent selection unchanged → pick a new row → step 2).
    • node tests/browser/first_run_added_models.mjs (new gate test) on the same dev server and production build: passed. It isolates the multi-model guidance (hint text, two markers, focus on the first added id, unchanged-then-updated modelSelections.agent) and three edit paths: a paused saved service → "Edit service" → save → no hint and no markers; an edit after a fresh multi-model save clears the stale hint and markers; a single saved service edit stays on the language list and keeps the previously picked modelSelections.agent.
    • npm test: 1113 passed, 0 failed.
    • npm run check:i18n: 3857 keys, 0 problems.
    • npm run check:browser-locale: 103 pages, 0 problems.
    • npm run check:browser-manifest: OK, 111 entries.
    • tsc --noEmit: clean.
    • After merging current main into the branch (de608775), re-ran on that head: tsc --noEmit clean, npm test 1113 passed, both browser tests passed on the dev server, and check:i18n, check:browser-locale, and check:browser-manifest were green.
    • Final head 1f670c02 (merges current main at 104cd9ed; the merge brings only main files, 26 changed, and the PR's own code is unchanged since 1d429709): tsc --noEmit clean, npm test 1114 passed, check:i18n 3859 keys / 0 problems, check:browser-manifest 112 entries gate=39, check:browser-locale 102 pages / 0 problems, and both first_run.mjs and first_run_added_models.mjs passed against the isolated fixture API and dev server.
  • Failing-before: the current test files were run against the base revision 83b142f0, built from source (vite build + vite preview) with the isolated fixture. Because these test files are introduced by this PR, the current versions were copied into a clean 83b142f0 worktree; nothing else in that worktree was changed.
    • first_run.mjs fails at tests/browser/first_run.mjs:212 with AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 'default' !== 'codex' (log).
    • first_run_added_models.mjs fails waiting for the "Added 2 language models..." hint that the base does not render (line 98 in the test copy attached to the base run, line 99 in the current test) (log).
    • On the previous head 4a9e43c5, first_run_added_models.mjs fails at tests/browser/first_run_added_models.mjs:128 with Expected values to be strictly equal: 1 !== 0 (the Added-N hint is present after an edit).
    • On the previous head a5a2c176, the extended first_run_added_models.mjs (applied to that worktree, served by the Vite dev server with the isolated fixture) fails at line 160 with Expected values to be strictly equal: 1 !== 0 (the stale hint survives an edit). A probe script reproduced both defects on the same SHA: after editing the paused service staleHint was 1 and staleMarkers was 2; after editing the single paused service the wizard advanced (advanced 1, stayed 0) and modelSelections.agent changed from 059ad3d6… to cc68fcde…. The logs and screenshots are in the evidence below; at 1d429709 the same probe reports staleHint 0, staleMarkers 0, advanced 0, stayed 1, and an unchanged agent.
  • Release checks on the final head 1f670c02 (run 47401497494): every lane passed — static, python (23m12s), frontend, browser (isolated) (10m20s), browser (assistant), browser (voice), desktop / macos, desktop / windows, and the aggregate checks / checks; the tests workflow and CodeQL are green too.

Earlier CI failures and their resolution

At the previous head 1d429709 (run 47392989081), frontend, desktop / macos, and desktop / windows built a fresh venv from the packaged wheel and resolved fastapi 0.165.1 with opentelemetry-api 1.46.0, failing in fastapi/telemetry/_asgi.py; browser (isolated) also had the known #686 canvas_toolbar_topbar.mjs:125 timeout. Both causes were fixed on main (wheel metadata pin and toolbar fix). On the final head 1f670c02, merged with main at 104cd9ed, every lane passes in run 47401497494, including both desktop jobs and browser (isolated).

Evidence that it works

Tested at head 1d429709, at the previous heads a5a2c176 and 4a9e43c5, and at 83b142f0. All runs used an isolated creation fixture; assistant runtimes and /api/model-configs were model doubles, not real providers.

Reproduction for #556/#559: open a fresh project with ?setup=welcome, choose "Use an existing harness" → Codex, go Back, choose "Set up a language model", fetch and save models.

Reproduction for the edit paths: open the language list with a saved service that is paused, choose "Edit service", and save.

Before (83b142f0):

  • The multi-model list shows no hint and no new-row markers in either locale.
  • After saving with Codex already chosen, the chat footer says "Default".

Before, en-US: no hint after saving two models
Before, zh-CN: no hint after saving two models
Before, zh-CN: chat runs on Default after the model save

After the harness and multi-model fixes (4a9e43c5):

  • The hint "Added 2 language models. Pick one to continue to step 2." and New · pick to continue markers appear on the added rows; picking one advances to step 2.
  • The chat footer keeps "Codex" after the model save.

After, en-US: hint and new-row markers
After, zh-CN: the same hint in Chinese
After, zh-CN: chat keeps Codex after the model save

Edit path, first round: clicking "Edit service" on the paused edit-b service and saving at 4a9e43c5 still shows the Added-N hint and marks both rows New · pick to continue:

Before the edit fix, en-US: hint after editing a service
Before the edit fix, zh-CN: hint after editing a service

At a5a2c176 the same save returns to the neutral list; the paused service is the entry point and no hint or marker remains, in both locales. Focus movement to the first added row is asserted by the test via document.activeElement.dataset.firstRunAgent; the recording shows the rows and the step change but does not visibly render a focus ring:

At a5a2c176, en-US: the paused service and its Edit service entry
At a5a2c176, en-US: neutral list after the edit
At a5a2c176, zh-CN: neutral list after the edit

Play the first-round recording at a5a2c176

Edit path, second round (the two defects fixed in 1d429709). At a5a2c176, editing the paused service after a fresh multi-model save left the hint and both markers, and editing the single paused service jumped to "Choose how to create" and replaced the picked agent:

At a5a2c176, en-US: the stale hint and markers survive the edit
At a5a2c176, en-US: editing the single service advances and replaces the selection
Play the before-fix recording at a5a2c176
The extended gate test failing at a5a2c176 (line 160, 1 !== 0)
Probe output at a5a2c176: staleHint 1, staleMarkers 2, advanced 1, stayed 0, agent changed

At 1d429709 both edits stay on the neutral language list with no hint or markers, and the previously picked agent is unchanged:

At 1d429709, en-US: the stale hint and markers are gone after the edit
At 1d429709, en-US: the single-service edit stays on the language list
Play the after-fix recording at 1d429709
Probe output at 1d429709: staleHint 0, staleMarkers 0, advanced 0, stayed 1, agent unchanged

The hint and marker rendering is unchanged between 4a9e43c5 and 1f670c02; the later commits modify only finishModelSetup, the onSaved callback, and the edit-path focus reset. Screenshots 04/05 show that rendering, and the tip's gate test asserts the hint, both markers, first-row focus, and the unchanged-then-updated agent.

Provider verification

  • No real-provider calls. The runs mocked /assistant/runtimes, the harness status endpoints, /api/model-configs, and /api/model-configs/discover. Saving language models used the real isolated creation API with a local base URL. No credentials appear in the diff.

Bilingual UI

  • Both locales updated: firstRun.pickAddedModel and firstRun.modelJustAdded in en-US/firstRun.ts and zh-CN/firstRun.ts. check:i18n and check:browser-locale pass, and the screenshots show both languages at the previous head and the final head.

Review

  • Self-review (candidate mode), first round: base 83b142f0, head a5a2c176 — WITHHOLD (required Release checks not green on that SHA for reasons outside the diff); no actionable defect found by the self-review.
  • Independent subagent review (candidate mode), first round: base 83b142f0, head a5a2c176 — REQUEST CHANGES. Findings: (1) a single-model edit auto-advanced to step 2 and overwrote the agent selection; (2) the PR body attributed the frontend/desktop failures to the base, which the run logs contradict; (3) a stale Added-N hint survived an edit; plus low findings on the wizard having no path back to Default after choosing a harness (out of scope), the failing-before evidence being narrative-only, and the focus-ring claim not being visible in the recording. Findings 1–3 are fixed in 1d429709; the CI attribution and focus wording are corrected above; the failing-before logs are now attached; the Default path is out of scope for [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556/[bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559.
  • Self-review (candidate mode), second round: base 83b142f0, head 1d429709 — WITHHOLD (required Release checks red on this SHA from the wheel-venv dependency drift and the known [test] canvas: clear the tool rail when seeding the toolbar drag #686 toolbar red), 93/100, no actionable defect.
  • Independent subagent review (candidate mode), second round: base 83b142f0, head 1d429709 — WITHHOLD, 93/100, no actionable defect; recommended updating onto current main, which contains [bugfix] packaging: cap opentelemetry-api<1.46 to avoid FastAPI ASGI TypeError #691 (opentelemetry-api<1.46) and [test] canvas: clear the tool rail when seeding the toolbar drag #686.
  • Final round, reviewed base 104cd9ed (origin/main when the reviews ran; main has since advanced to 42c5dc39 with [ci] python: parallelize suite across three shards and isolate native CLI regressions #692, a CI test-sharding change only, and the PR's diff against 42c5dc39 is the same 9 files, +338/−26), head 1f670c02:
    • Self-review (candidate mode): PASS, 90/100. Ratings: scope 3/3, correctness 3/3, validation 3/3, claim evidence 2/3 (corrected-result screenshots and recordings were captured at 1d429709/4a9e43c5; the tip is byte-identical for WelcomeScreen.tsx and both test files, and the tip's CI ran both), simplicity 3/3 (no added comments).
    • Independent subagent review (candidate mode): PASS, 90/100, same dimension ratings and the same bounded evidence gap. It confirmed all 21 artifact URLs return HTTP 200, the CI isolated-lane log shows "PASS first-run setup (22.5s)", "PASS first-run added models (8.6s)" and "36/36 browser workflows passed", check:i18n is 3859 keys / 0 problems and check:browser-manifest 112 entries / gate=39, mergeStateStatus is CLEAN, and the PR files are byte-identical between 1d429709 and 1f670c02.
    • Independent findings, all non-blocking: (1) after a harness is chosen, the wizard has no explicit path back to the Default runtime; out of scope for [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556/[bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559, a follow-up issue if Default must remain reachable; (2) the Review record was stale — fixed in this update; (3) corrected-result artifacts are from earlier heads — the bounded gap above, mitigated by the byte-identity argument the reviewer accepted; (4) the failing-before evidence for the primary [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556/[bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559 tests was narrative only — the base run logs are now attached (22, 23); (5) a line-number nit, corrected above.
  • Material validation gaps: corrected-result screenshots and recordings are at 1d429709/4a9e43c5, not the tip; the reviewed component and tests are byte-identical at the tip and the tip's CI executed both tests. The full Python suite, npm run build, and the other browser lanes were not run locally; Release checks on the tip are green.

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:harness Harness and skill integration (Default, OpenCode, Codex, Claude Code, Jiuwen, DSH) type:bug Something is broken labels Nov 28, 2026
@Zhangbo-cn
Zhangbo-cn force-pushed the fix/first-run-harness-and-guidance branch from 1732977 to 23a4deb Compare November 29, 2026 03:54
@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation area:i18n Localisation and bilingual UI labels Nov 29, 2026
@kunkunblueberry

kunkunblueberry commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

PASS 23a4deb Fixes #556, #559

  • [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556: connect() reads the draft before saving a language model and keeps a non-default runtime, updating only modelSelections.agent. The second half of that fix matters as much — the readiness check now runs against the runtime that will actually run, not default.
  • [bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559: the multi-model save says how many were added and asks the user to pick one, with the new rows marked and focused. Single-model saves still continue automatically, so the common path is unchanged.
  • Both new strings ship in en-US and zh-CN together, and the browser test asserts the two behaviours that were broken: runtime retained after a second save, and modelSelections.agent unchanged until a pick.

Ran: gh pr checks 560 on 23a4deb (13/13); read the WelcomeScreen diff, both locale files and the new browser assertions.
Not run: first_run.mjs locally.

@Zhangbo-cn
Zhangbo-cn force-pushed the fix/first-run-harness-and-guidance branch 3 times, most recently from 55b08ff to 6140a6a Compare December 4, 2026 16:27
Saving a language model inside the setup wizard always wrote runtime=default,
silently replacing a harness the user had just picked (Claude Code, Codex,
OpenCode). A language-model save now keeps a non-default runtime, validates
the runtime that actually runs, and only updates modelSelections.agent.
Explicitly picking another harness still switches.

Also make a multi-model save understandable: show how many models were added,
mark the new rows, move focus to the first one, and keep the single-model
auto-continue behaviour unchanged.

Refs ThinkFlowLab#556, ThinkFlowLab#559

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Zhangbo-cn
Zhangbo-cn force-pushed the fix/first-run-harness-and-guidance branch from 6140a6a to 4a9e43c Compare December 4, 2026 16:30
dev and others added 4 commits December 5, 2026 01:13
The language-model form reports every saved model to the welcome screen.
Editing an existing service therefore showed the Added-N hint and the
new-row markers, implying the user had just added models and must pick
one. Pass the edit flag through finishModelSetup so an edit returns to
the language list without the addition guidance.

Split the multi-model guidance journey into its own gate test so it can
run against earlier revisions without the full first-run setup, and
cover an unavailable kept harness plus the default runtime on a fresh
project in first_run.mjs.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…anguage list

An edit save with one usable model connected and advanced to step 2,
overwriting the chosen assistant, and an edit after a multi-model save
left the added-model hint and markers behind. Return after an edit
before the single-model path and clear the added-model guidance.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:canvas Canvas, nodes and direct manipulation area:harness Harness and skill integration (Default, OpenCode, Codex, Claude Code, Jiuwen, DSH) area:i18n Localisation and bilingual UI type:bug Something is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants